{% extends "sil18VitrineBundle::layout.html.twig" %}

{% block content %}
<div class="tpl_panier">
    <h2>Votre Panier</h2>
    <a href="{{ path('viderPanier') }}">

    </a> 
    
    {% if panier.getContenu() is empty %}
        <p>Le panier est vide</p>        
    {% else %}
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>Désignation</th>
                    <th>Disponibilité</th>
                    <th>Prix unité</th>
                    <th>Quantité</th>
                    <th>Total</th>
                    <th>
                        <button type="button" class="btn btn-danger">
                            <span class="glyphicon glyphicon-trash"></span>
                        </button>                    
                    </th>
                </tr>
            </thead>
            {% for article in panierArticles %}
                <tr>
                    <td>{{ article.libelle }}</td>
                    {% if article.stock <= 0 %}
                        <td class="nonDispo">Non Disponible</td>
                    {% else %}
                        <td class="dispo">Disponible</td>
                    {% endif %}
                    <td>{{ article.prix }} €</td>
                    <td>{{ panier.qteArticle( article.id ) }}</td>
                    <td>{{ article.prix * panier.qteArticle( article.id ) }}</td>
                    <td>
                        <a href="{{ path('supprimeArticle', {'idArticle' :  article.id }) }}">
                            <button type="button" class="btn btn-warning">                
                                <span class="glyphicon glyphicon-remove"></span>
                            </button>
                        </a>
                    </td>
                </tr>
            {% endfor %}    
        </table>
        <h2>Prix : {{ prixTotal }} € </h2>
        <a href="{{ path('validationPanier') }}">
            <button type="button" class="btn btn-primary">Commander</button>
        </a>        
    {% endif %}
</div>
{% endblock %}